<%-- 
    Document   : actiontotalTour
    Created on : Nov 14, 2012, 5:23:11 PM
    Author     : Nguyen Hung
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <script type="text/javascript" language="javascript">
        var open_cur = 0;
        $j = jQuery.noConflict();
        $j(document).ready(function(){
            $j(".abcdelete" ).click(function() {
                $j(this).parent().parent().parent().parent().hide();
                     
            });
            $j(".ncc" ).live('change',function() {
               ncc = $j(this).val();
               if(ncc==2){
                   $j(this).parent().parent().next().css('display','block');
               }else{
                   $j(this).parent().parent().next().css('display','none');
               }
                     
            });
        });
        function countChar(val) {
            var len =  val.value.length;
                
               
            if (len <= 320 && len >= 0) {
                    
                var i = 320 - len;  
                   
                $j('.sgt_sms_warming').text("Còn "+i+" kí tự"); 
                $j('.sms_alert').addClass("displaynone")  
                $j('.hiddenSend').removeClass("displaynone");
                //                     alert(i);
            }else {
                $j('.sms_alert').removeClass("displaynone")  
                $j('.hiddenSend').addClass("displaynone");
            }
        };
    </script>
    <style>
        .sms_alert{
            color: red;
            width: 100%;
            text-align: center;
            float: left;


        }
/*        .nccabc{
            display: none;
        }*/
        .displaynone{
            display:none; 

        }
    </style>
    <body>
        <f:view>
            <a4j:form>
                <a4j:status onstart="#{rich:component('statPane')}.show()" onstop="#{rich:component('statPane')}.hide()" />
                <h:panelGroup id="abcd">
                    <div class="inputSMS">
                        <h:panelGroup rendered="#{templateController.group==0}"> <h:outputText style="float:left;width:97%;" value="SỐ NGƯỜI GỬI : #{templateController.numberSMS}"/></h:panelGroup>
                        <h:panelGroup rendered="#{templateController.group==1}"> <h:outputText style="float:left;width:97%;" value="SỐ NGƯỜI GỬI :1 (#{templateController.phone})"/></h:panelGroup>
                        <h:graphicImage style="float:left;width:3%;" styleClass="abcdelete" value="../images/delete_1.png"/>
                    </div>
                </h:panelGroup>
                <div class="inputSMS">
                    <div style="width: 20%;text-align: right;float: left;"><h:outputText value="Thêm SDT :"/></div>
                    <div style="width: 80%;text-align: left;float: left;"><h:inputText style="width:87.5%;" value="#{templateController.addnumbersms}"/></div>
                </div>
                <div class="inputSMS">
                    <div style="width: 20%;text-align: right;float: left;"><h:outputText value="Thông tin gửi :"/></div>
                    <div style="width: 80%;text-align: left;float: left;"><h:inputText style="width:87.5%;" value="#{templateController.cv052}"/></div>
                </div>
                <div class="inputSMS">
                    <div style="width: 20%;text-align: right;float: left;"><h:outputText value="Chọn dịch vụ :"/></div>
                    <div style="width: 80%;text-align: left;float: left;">
                        <h:selectOneMenu styleClass="ncc" value="#{templateController.flagncc}">
                            <f:selectItem itemLabel="FIBO" itemValue="1"/>
                            <f:selectItem itemLabel="BEYU" itemValue="2"/>
                            <a4j:support event="onchange" actionListener="#{templateController.changeSuppliersms}" reRender="sendsms,template1"/>
                        </h:selectOneMenu>
                    </div>
                </div>
                <div class="inputSMS nccabc">
                    <div style="width: 20%;text-align: right;float: left;"><h:outputText value="Template SMS :"/></div>
                    <div style="width: 80%;text-align: left;float: left;">
                        <h:selectOneMenu  style="width:87.5%;height:25px;" value="#{templateController.pc050}">
                            <f:selectItem itemLabel="---------" itemValue="0"/> 
                            <f:selectItems value="#{m010Controller.combolistM010}"/>
                            <a4j:support event="onchange"  actionListener="#{templateController.onchangeTemplate}" reRender="template,template1,tem,tem1,tem2" />
                        </h:selectOneMenu>
                    </div>
                </div>


                <div class="inputSMS">
                    <div style="width: 20%;text-align: right;float: left;"><h:outputText value="Thể loại :"/></div>
                    <div style="width: 80%;text-align: left;float: left;">
                        <h:selectOneMenu style="width:87.5%;height:25px;" value="#{templateController.mn026}">
                            <f:selectItem itemLabel="Người tham gia Tour" itemValue="1"/> 
                            <f:selectItem itemLabel="Hàng không" itemValue="2"/> 
                            <f:selectItem itemLabel="Phòng ốc" itemValue="3"/> 
                            <f:selectItem itemLabel="Thủ tục Visa" itemValue="4"/> 
                            <f:selectItem itemLabel="Xe bus" itemValue="5"/> 
                        </h:selectOneMenu>

                    </div>
                </div>

                <h:panelGroup id="template1">
                    <h:panelGroup rendered="#{templateController.flagncc==2}">

                        <h:panelGroup rendered="#{templateController.pc050!=0}">
                            <div class="inputSMS">
                                <div style="width: 100%;text-align: center;float: left;color: yellow;">

                                    <h:panelGroup rendered="#{templateController.pc050==3}">
                                        <span >
                                            Note : Chỉ thay đổi {P1} và {P2}.Nếu thay đổi sai Nhân Viên tự chịu trách nhiệm...Yêu cầu tin nhắn không có dấu
                                        </span>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{templateController.pc050==4}">
                                        <span >
                                            Note : Chỉ thay đổi {P3},{P4} và {P5}.Nếu thay đổi sai Nhân Viên tự chịu trách nhiệm...Yêu cầu tin nhắn không có dấu
                                        </span>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{templateController.pc050==5}">
                                        <span >
                                            Note : Chỉ thay đổi {P1},{P2},{P3},{P4},{P5},{P6},{P7}.Nếu thay đổi sai Nhân Viên tự chịu trách nhiệm...Yêu cầu tin nhắn không có dấu
                                        </span>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{templateController.pc050==6}">
                                        <span >
                                            Note : Chỉ thay đổi {P2} và {P3}.Nếu thay đổi sai Nhân Viên tự chịu trách nhiệm...Yêu cầu tin nhắn không có dấu

                                        </span>
                                    </h:panelGroup>

                                </div>
                            </div>
                        </h:panelGroup>
                    </h:panelGroup>  
                </h:panelGroup>
                <div class="inputSMS1">
                    <div style="width: 20%;text-align: right;float: left;"><h:outputText style="width:100%;float:left;" value="Nội dung :"/>
                        <h:outputText style="margin-right:6px;color:yellow" id="sgt_sms_warming" styleClass="sgt_sms_warming"  value="Còn #{templateController.countchar} kí tự"/>
                    </div>

                    <div style="width:80%;text-align: left;float: left;">
                        <h:panelGroup id="template">

                            <h:inputTextarea style="width:100%;height:100px;" onkeyup="countChar(this)"  styleClass="abc" value="#{templateController.cv051}"/>
                        </h:panelGroup>

                    </div>
                </div>
                <div><h:outputLabel value="Bạn đã vượt quá số kí tự cho phép" styleClass="sms_alert displaynone" /></div>
                <div class="inputSMS hiddenSend">
                    <h:inputHidden value="#{templateController.phone}"/>
                    <h:inputHidden value="#{templateController.fn100}"/>
                    <h:inputHidden value="#{templateController.pm020}"/>
                    <h:inputHidden value="#{templateController.group}"/>
                    <h:inputHidden value="#{templateController.namepage}"/>
                    <a4j:commandButton style="float:right;" value="SEND" reRender="reload4" actionListener="#{templateController.saveTemplateSMSTour}"/>                             

                </div>
                <rich:modalPanel styleClass="pleaseimage" id="statPane" autosized="true" minHeight="10" minWidth="80"
                                 height="10" width="80" zindex="2000">
                    <h:graphicImage value="/images/loadingAnimation.gif" alt="ai" />
                </rich:modalPanel>
            </a4j:form>
        </f:view>

    </body>
</html>
